<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2016/11/2
 * Time: 20:11
 */
header('Content-Type:text/html;charset=utf-8');
echo '<h2>接收到新注册用户！</h2>';
echo '<p>用户名:'.$_POST['username'].'</p>';
echo '<p>密码:'.$_POST['password'].'</p>';
echo '<p>邮箱:'.$_POST['email'].'</p>';
echo '<p>IP地址:'.$_SERVER['REMOTE_ADDR'].'</p>';
echo '<p>浏览器环境:'.$_SERVER['HTTP_USER_AGENT'].'</p>';
echo '<p>请求来源:'.$_SERVER['HTTP_REFERER'].'</p>';
$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];
$link=mysqli_connect('localhost','root','123456');
if(!$link){
    die;
}
mysqli_query('set name utf8');
mysqli_query('use`itcast`');
$username=mysqli_real_escape_string($username);
$email=mysqli_real_escape_string($email);
$sql="select`id`form`user`where`username`='$username'";
$rst=mysqli_query($sql);
if(mysqli_fetch_row($rst)){
    die;
}
$password=md5($password);
$sql="insert into`user`(`username`,`password`,`email`)values('$username','$password','$email')";
$rst=mysqli_query($sql);